/*
 * @Author: 曹澳龙
 * @Date: 2023-08-02 11:58:10
 * @LastEditTime: 2023-08-02 11:58:10
 * @LastEditors: 曹澳龙
 * @Description:
 *
 */

import {Component} from "react";
import PropTypes from "prop-types";
import Item from "../item";
import "./index.css";

class List extends Component<any, any> {

    static propTypes = {
        todos: PropTypes.array.isRequired,
        updateTodo: PropTypes.func.isRequired,
        deleteTodo: PropTypes.func.isRequired
    }

    render() {
        const {todos, updateTodo, deleteTodo} = this.props;
        return (
            <ul className="todo-main">
                {
                    todos.map((todo: any)=>{
                        return <Item updateTodo={updateTodo} deleteTodo={deleteTodo} key = {todo.id} {...todo}/>
                    })
                }
            </ul>
        );
    }
}

export default List;